<?php
/**
 * @author kwor
 * @url http://www.kwor.cn
 * 
 */
session_start();
require_once 'data/mysql_config.php';
header("Content-Type:text/html;charset=".SN_CHARSET);
require_once 'inc/lib/base/cls_nusoap.php';
require_once 'inc/lib/base/lib_common.php';
require_once 'inc/lib/base/cls_template.php';
require_once 'inc/lib/admin/lib_admin.php';
require_once 'inc/lib/base/cls_pageination.php';
if(check_admin_login()==false)
{
	local_header('index.php');
}
$xueniao = new cls_template;

if (!file_exists('../temp/caches'))
{
    @mkdir('../temp/caches', 0777);
    @chmod('../temp/caches', 0777);
}

if (!file_exists('../temp/compiled/admin'))
{
    @mkdir('../temp/compiled/admin', 0777);
    @chmod('../temp/compiled/admin', 0777);
}

clearstatcache();
$pageination=new pageination();//实例化分页类
$systemconf=$db->getrow('select skin,lang,editor from sn_admin where id = '.$_SESSION['adminid']);
$lang=$systemconf['lang'];
$editor=$systemconf['editor'];
$tempath=$systemconf['skin'];

/**
 * 模板或语言包错误处理，需进一步完善
 */
if(!file_exists("lang/".$lang."/base.php")){
	$lang='zh_cn';
	$error_c['nolang_err']='您选择的后台语言包文件缺失，系统启用了默认语言包!';
}

if(!file_exists("templates/".$tempath."/login.htm")){
	$tempath='default';
	$error_c['nothem_err']='您选择的后台模板文件缺失，系统启用了默认模板!';
}

/*
if($_SESSION['admintype']=='super'){
	if($_SESSION['adminpower']!=='true'){
		$error_c['adminpower_err']='你现在的管理级别，需要确认权限，否者部分操作无法进行!';
	}
}
*/

//语言、模板文件选择
include_once("lang/".$lang."/base.php");
$xueniao->template_dir   = "templates/".$tempath."/";
$xueniao->cache_dir      = "../temp/cache/";
$xueniao->compile_dir    = "../temp/compiled/admin";
$siteinfo_c=array(
tempdir=>"templates/".$tempath."/",
user=>$_SESSION['user'],
admintype=>$_SESSION['admintype'],
adminpower=>$_SESSION['adminpower'],
changepass=>'adminuser.php?action=changepass',
editselfinfo=>'adminuser.php?action=adminset',
logout=>'index.php?action=logout',
systeminfo=>$lang['systeminfo'],
leftmenu=>'left.php',
checkcode=>'lib/base/lib_chkcode.php',
version=>SYS_VERSION,
);


/*
$m=browseinfo();//目前算法不安全
if($m!=='Unknown browse'){ //非正常浏览器一律展示手机页面
	$xueniao->template_dir ="templates/".$tempath."/";
	$xueniao->compile_dir    = "../temp/compiled/admin";
	$siteinfo_c['tempdir']="templates/".$tempath."/";
}else {
	$xueniao->template_dir ="mob_templates/default/";
	$xueniao->compile_dir    = "../temp/compiled/admin/mob";
	$siteinfo_c['tempdir']="mob_templates/default/";
}
*/



$xueniao->assign("siteinfo",$siteinfo_c);

$xueniao->assign("error",$error_c);






?>